import * as API from "@/api/axios";
import * as util from "@/common/util";

export default {

    //消息列表
    getMessages: (params, page) => {
        const url = util.replacePageNumAndSize('/manage/message-push/{pageNum}/{pageSize}', page)
        return API.axiosGetAPI(url, params)
    },

    //消息详情
    getMsgDetail: (params) => {
        return API.axiosGetAPI(`/manage/message-push/detail`, params)
    },

    //消息推送记录
    getMsgRecord: (params, page) => {
        const url = util.replacePageNumAndSize('/manage/message-push/record/{pageNum}/{pageSize}', page)
        return API.axiosGetAPI(url, params)
    },

    //获取消息编辑信息
    getMessags: (params) => {
        return API.axiosGetAPI(`/manage/message-push/get-message`, params)
    },

    //搜索用户
    getUser: (params) => {
        return API.axiosGetAPI(`/manage/message-push/search-user`, params)
    },

    //编辑、新增消息
    createModify: (params) => {
        const headers = {
            'lang-key': params.id ? 'branch_Edit' : 'branch_Create'
        }
        const url = params.id ? '/manage/message-push/update' : '/manage/message-push/creat'
        if (params.id) {
            return API.axiosPutAPI(url, params, headers)
        } else {
            return API.axiosPostAPI(url, params, headers)
        }
    },


    //消息推送
    pushMessage: (params) => {
        return API.axiosGetAPI(`/manage/message-push/push`, params)
    },

    //删除信息
    deleteMessage: (id) => {
        const headers = {
            'lang-key': 'Remove_batch'
        }
        return API.axiosDeleteAPI(`/manage/message-push/${id}`, '', headers)
    },


}